//
//  BaseViewController.m
//  TakeYouTourTogether
//
//  Created by king on 15/11/26.
//  Copyright © 2015年 king. All rights reserved.
//

#import "BaseViewController.h"
#import "AppDelegate.h"
@interface BaseViewController ()

@end

@implementation BaseViewController
- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeColor:) name:@"changeColor" object:nil];
    }
    return self;
}
#pragma mark - Method viewDidLoad
- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationController.navigationBar.translucent = NO;
    self.view.backgroundColor = [UIColor whiteColor];
    self.navigationController.navigationBar.barTintColor = [UIColor colorWithRed:0.850 green:0.250 blue:0.180 alpha:1.000];
}
- (void)changeColor:(NSNotification *)notification{
    NSLog(@"%@",notification.userInfo[@"name"]);
    [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:notification.userInfo[@"name"]] forBarPosition:UIBarPositionAny barMetrics:UIBarMetricsDefault];
}
- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    //国际化
    [LanguageTool setUserlanguage:[LanguageTool shareLanguage].iphoneLanguage];
}

#pragma mark - Method didReceiveMemoryWarning
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
